(function(){  
  // 写功能模块、尽量都写在立即调用函数中
  // DOMContentLoaded 文档加载到页面完毕就会触发
  document.addEventListener('DOMContentLoaded', function(){
    var qianbaoBtn = document.querySelector('.icon-qianbao');
    var zhezhao = document.querySelector('.zhezhao');
    var content = document.querySelector('.loginContent');
    var isShow = false;
    


    qianbaoBtn.addEventListener('click', function(e){
      isShow = true;
      zhezhao.classList.add('active');
      setTimeout(function(){
        content.style.transform = 'translateX(0)';
      },0);
    });

    var close = document.querySelector('.close');
    close.addEventListener('click', function(){
      isShow = false;
      content.style.transform = 'translateX(200px)';
    })
    content.addEventListener('transitionend', function(){
      if(!isShow){
        zhezhao.classList.remove('active');
      }
    })


  })
})();